﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="js.aspx.cs" Inherits="Enterprise.UI.Web.Modules.CaiWuBu.js" ValidateRequest="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
     <script type="text/javascript" src="/FCF/FusionCharts.js"></script>
    <script type="text/javascript" src="/FCF/jquery.min.js"></script>
    <script type="text/javascript">
        $(function ($) {
            loadcol(2, 3);
            //loadrow(1);
        });
        function loadrow(row) {
            var title = $(".htmlgrid tr:eq(" + row + ") td").eq(0).text();
            var xml = "<graph caption='" + title + "' yAxisName='' showNames='1' decimalPrecision='2'   formatNumberScale='2' showExportDataMenuItem='1' baseFontSize='12' showFCMenuItem='0'  showBorder='0' yAxisMaxValue='70000'>";
            var rows = $(".htmlgrid tr").length; //表格行数
            var width = $('#hd_width').val();
            var height = $('#hd_height').val()

            var cols = $(".htmlgrid tr:eq(0) th").length; //表格列数
            //alert(cols);
            for (var i = 1; i < cols - 1; i++) {
                var caption = $(".htmlgrid tr:eq(0) th").eq(i).text(); //表头
                var val = $(".htmlgrid tr:eq(" + row + ") td").eq(i).text(); //数值
                xml += "<set name='" + caption + "' value='" + val + "'/>";
            }
            xml += "</graph>";
            //alert(xml);
            
            chart(xml, "../../FCF/Column2D.swf", width, height, "chartContainer");
        }

        function loadcol(namecol, valuecol) {

            var title ="公司："+ $(".htmlgrid tr:eq(1) td:eq(0)").text() +" "+ $(".htmlgrid tr:eq(1) td:eq(1)").text() +" 年 ";
            //alert(title);
            var xml = "<graph caption='" + title + "' yAxisName='' showNames='1' decimalPrecision='2'   formatNumberScale='2' showExportDataMenuItem='1' baseFontSize='12' showFCMenuItem='0'  showBorder='0' >";
            var rows = $(".htmlgrid tr").length; //表格行数
            var width = $('#hd_width').val();
            var height = $('#hd_height').val()
            var showtable=$('#hd_isshow').val();

            var cols = $(".htmlgrid tr:eq(0) th").length; //表格列数
            //alert(cols);
            for (var i = 1; i < rows; i++) {
                var caption = $(".htmlgrid tr:eq(" + i + ") td").eq(namecol).text(); //表头
                var val = $(".htmlgrid tr:eq(" + i + ") td").eq(valuecol).text(); //数值
                xml += "<set name='" + caption + "' value='" + val + "'/>";
            }
            xml += "</graph>";
           // alert(xml);
            chart(xml, "../../FCF/Column2D.swf", width, height, "chartContainer", showtable);
            $(".htmlgrid").hide();
        }

        function chart(xml, swf, width, height, chartdiv,showgrid) {
            var chartObj = new FusionCharts(swf, "chartId", width, height, "0", "1");
            chartObj.setDataXML(xml);
            //alert(xml);
            chartObj.configure("ChartNoDataText", "no data to display");
            chartObj.render(chartdiv);
            if (showgrid == "1") {
                var myGrid = new FusionCharts("../../FCF/SSGrid.swf", "myGrid1", width, height, "0", "1");
                myGrid.setDataXML(xml); myGrid.render("gridDiv");
            }
        }
    </script>
    </head>
<body>
    <form id="form1" runat="server">
    <asp:Literal ID="lthtml" runat="server"></asp:Literal>  
    <asp:HiddenField ID="hd_isshow" runat="server" Value="1" ClientIDMode="Static" />  
    <asp:HiddenField ID="hd_width" runat="server" ClientIDMode="Static" Value="400" />
    <asp:HiddenField ID="hd_height" runat="server" ClientIDMode="Static" Value="300" />

     <div id="chartContainer">图表显示</div>
     <div id="gridDiv"></div>
    </form>
</body>
</html>
